<template>
  <div>
    <h3>son.vue -- 这个子组件只是看到销毁钩子</h3>
    <grand-son />
  </div>
</template>

<script>
import grandSon from "./grandSon.vue";
export default {
  components: {
    grandSon,
  },
  data() {
      return {
          test: 'son里的数据',
          timer: null
      };
  },
  beforeCreate() {
    console.log("儿子的beforeCreate");
  },

  created() {
    console.log("儿子的created");
    // 定时器
    this.timer = setInterval(() => {
        console.log('喵了个咪的')
    }, 1000);
  },

  beforeMount() {
    console.log("儿子的beforeMount");
  },

  mounted() {
    console.log("儿子的mounted");
  },

  beforeDestroy() {
    console.log("儿子的beforeDestroy");

    clearInterval(this.timer)
  },

  destroyed() {
    console.log("儿子的destroyed");
  },
};
</script>

<style>
</style>